package com.bizframework.security.domain.dao.impl;

import java.util.List;

import com.bizframework.springhb.support.dao.BaseDaoHBImpl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.bizframework.security.domain.dao.PermissionDao;
import com.bizframework.security.domain.entity.Permission;

@Repository("permissionDao")
public class PermissionDaoImpl extends BaseDaoHBImpl<Permission, String> implements PermissionDao {

	@SuppressWarnings("unchecked")
	public List<Permission> getAllPermissionByOrder() {
		StringBuffer hql = new StringBuffer("from Permission p order by p.parentPermission.id, p.displayOrder");
		Query query = getSession().createQuery(hql.toString());
		return query.list();
	}

}
